<template>
  <div>
    <el-dialog
      title="文档发布"
      v-model="showDialog"
      :before-close="close"
      width="1200px"
      append-to-body
    >
      <PublishList :fileList="fileList"></PublishList>
      <div class="dialog-footer">
        <el-button
          type="primary"
          size="small"
          @click="
            () => {
              emits('submit')
            }
          "
        >
          发布
        </el-button>
        <el-button size="small" @click="close">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script setup name="publishDialog">
import PublishList from './publishList.vue'
const props = defineProps({
  open: {
    type: Boolean,
    default: false,
  },
  fileList: {
    type: Array,
    default: () => {
      return []
    },
  },
})

const emits = defineEmits(['close'])
const showDialog = computed({
  get() {
    return props.open
  },
  set(val) {
    emits('update:open', val)
  },
})

function close() {
  emits('close')
}
</script>

<style scoped>
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin: 45px 0 0 0;
}
</style>
